﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ModeSetCenter.aspx.cs" Inherits="ModeSetCenter" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>模板控制中心</title>
    <script>
        var getTasks = function () {
            var msg = "",
                selChildren = App.TreePanel1.getChecked();

            Ext.each(selChildren, function (node) {
                if (msg.length > 0) {
                    msg += ", ";
                }

                msg += node.data.text;
            });

            Ext.Msg.show({
                title: "Completed Tasks",
                msg: msg.length > 0 ? msg : "None",
                icon: Ext.Msg.INFO,
                minWidth: 200,
                buttons: Ext.Msg.OK
            });
        };
        var edit = function (editor, e) {
            if (!(e.value === e.originalValue || (Ext.isDate(e.value) && Ext.Date.isEqual(e.value, e.originalValue)))) {
                CompanyX.Edit(e.record.data.mu_id, e.record.data.fid, e.field, e.originalValue, e.value, e.record.data);
            }
        };
        var edit2 = function (editor, e) {

            if (!(e.value === e.originalValue || (Ext.isDate(e.value) && Ext.Date.isEqual(e.value, e.originalValue)))) {
                CompanyX.Edit2(e.record.data.lid, e.field, e.originalValue, e.value, e.record.data);
            }
        };
        var rightchange = function (obj) {
            CompanyX.RightChangeSave(App.hf_tree_id.value, App.hf_user_id.value, obj.id, obj.getValue());
        }
        var showtest = function () {
            //            var selectionMode = App.TreePanel1.getSelectionModel();
            //            var node = App.TreePanel1.getRootNode().
            //            alert(node.data.text);
            //            alert(selection.attributes.text);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Viewport ID="Viewport1" runat="server">
            <LayoutConfig>
                <ext:HBoxLayoutConfig Align="Stretch" />
            </LayoutConfig>
            <Defaults>
                <ext:Parameter Name="margin" Value="0" Mode="Value" />
            </Defaults>
            <Items>
                <ext:TreePanel ID="TreePanel1" runat="server" Title="模块列表" Icon="Accept" CollapseDirection="Left"
                    Collapsible="true" Height="400" Width="250" UseArrows="true" AutoScroll="true"
                    Animate="true" RootVisible="false">
                    <TopBar>
                        <ext:Toolbar runat="server">
                            <Items>
                                <ext:Button runat="server" Text="新增同级" Icon="Add">
                                    <DirectEvents>
                                        <Click OnEvent="DoAdd">
                                        </Click>
                                    </DirectEvents>
                                    <Listeners>
                                        <Click Fn="showtest">
                                        </Click>
                                    </Listeners>
                                </ext:Button>
                                <ext:Button runat="server" Text="新增下级" Icon="ArrowBranch">
                                    <DirectEvents>
                                        <Click OnEvent="DoDwonAdd">
                                        </Click>
                                    </DirectEvents>
                                </ext:Button>
                                <ext:Button runat="server" Text="删除" Icon="Delete">
                                    <DirectEvents>
                                        <Click OnEvent="BtnDelete">
                                        </Click>
                                    </DirectEvents>
                                </ext:Button>
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                    <Root>
                    </Root>
                    <Listeners>
                        <CheckChange Handler="var node = Ext.get(this.getView().getNode(item));
                                      node[checked ? 'addCls' : 'removeCls']('complete')" />
                        <%--<Render Handler="this.getRootNode().expand(true);" Delay="50" />--%>
                    </Listeners>
                    <SelectionModel>
                        <ext:TreeSelectionModel>
                            <Listeners>
                                <Select Handler="#{moudleform}.getForm().loadRecord(record);" />
                            </Listeners>
                            <DirectEvents>
                                <Select OnEvent="Tree_Row_Click">
                                    <EventMask ShowMask="true" Msg="数据加载中...">
                                    </EventMask>
                                </Select>
                            </DirectEvents>
                        </ext:TreeSelectionModel>
                    </SelectionModel>
                </ext:TreePanel>
                <ext:BoxSplitter ID="BoxSplitter1" runat="server" Collapsible="true" CollapseTarget="Prev" />
                <ext:Panel runat="server" Flex="1" Layout="BorderLayout" Frame="true">
                    <Items>
                        <ext:Panel Title="模板属性设置" Region="North" ID="Panel3" runat="server" Split="true"
                            Collapsible="true" PaddingSummary="5px 5px 0" Width="600" ButtonAlign="Center"
                            Icon="ApplicationViewList" Layout="Column">
                            <Items>
                                <ext:FormPanel ID="moudleform" runat="server" Layout="Column" Height="250" Border="false"
                                    Reference="form" ButtonAlign="Center" StyleSpec="overflow: auto;">
                                    <Items>
                                        <ext:FieldSet ID="FieldSet1" runat="server" Title="工具栏菜单" Width="800" Height="50"
                                            Layout="ColumnLayout" Margin="5">
                                            <Items>
                                                <ext:Checkbox ID="Checkbox1" runat="server" BoxLabel="浏览" Padding="5" />
                                                <ext:Checkbox ID="CheckboxDog" runat="server" BoxLabel="新增" Padding="5" />
                                                <ext:Checkbox ID="CheckboxCat" runat="server" BoxLabel="修改" Padding="5" />
                                                <ext:Checkbox ID="CheckboxMonkey" runat="server" BoxLabel="删除" Padding="5" />
                                                <ext:Checkbox ID="Checkbox2" runat="server" BoxLabel="导出" Padding="5" />
                                                <ext:Checkbox ID="Checkbox3" runat="server" BoxLabel="导入" Padding="5" />
                                            </Items>
                                        </ext:FieldSet>
                                        <ext:Component ID="Component1" runat="server" Width="1000" />
                                        <ext:TextField ID="txtparent" runat="server" FieldLabel="上级" Padding="3" LabelWidth="80"
                                            ReadOnly="true" />
                                        <ext:TextField ID="txtindx" runat="server" FieldLabel="序号" Padding="3" LabelWidth="80"
                                            AllowBlank="false" />
                                        <ext:TextField ID="txtmodecode" runat="server" FieldLabel="代号" Padding="3" LabelWidth="80"
                                            AllowBlank="false" />
                                        <ext:TextField ID="txtmodename" runat="server" FieldLabel="名称" Padding="3" LabelWidth="80"
                                            AllowBlank="false" Width="300" />
                                        <ext:Component ID="Component2" runat="server" Width="1000" />
                                        <ext:ComboBox ID="txtmtype" runat="server" FieldLabel="类型" Padding="3" LabelWidth="80">
                                            <Items>
                                                <ext:ListItem Text="类型" Value="0" />
                                                <ext:ListItem Text="功能" Value="1" />
                                                <ext:ListItem Text="网格" Value="2" />
                                                <ext:ListItem Text="条件" Value="3" />
                                                <ext:ListItem Text="输出项" Value="4" />
                                                <ext:ListItem Text="自定义事件" Value="5" />
                                            </Items>
                                        </ext:ComboBox>
                                        <ext:ComboBox ID="txtstype" runat="server" FieldLabel="来源" Padding="3" LabelWidth="80">
                                            <Items>
                                                <ext:ListItem Text="KM平台" Value="0" />
                                                <ext:ListItem Text="恒康系统" Value="1" />
                                            </Items>
                                        </ext:ComboBox>
                                        <ext:TextField ID="txttablename" runat="server" FieldLabel="表名" Padding="3" LabelWidth="80" />
                                        <ext:TextArea ID="txturl" runat="server" FieldLabel="命令" Width="800" Padding="3"
                                            AllowBlank="false" LabelWidth="80">
                                        </ext:TextArea>
                                    </Items>
                                    <Buttons>
                                        <ext:Button Text="保存" runat="server" Icon="Disk">
                                            <DirectEvents>
                                                <Click OnEvent="Btn_SaveForm">
                                                </Click>
                                            </DirectEvents>
                                        </ext:Button>
                                        <ext:Button ID="Button2" Text="创建布局" runat="server" Icon="ApplicationViewDetail">
                                            <DirectEvents>
                                                <Click OnEvent="LinkButton5_Click" Timeout="90000">
                                                    <EventMask Msg="正在加载中..." ShowMask="true">
                                                    </EventMask>
                                                </Click>
                                            </DirectEvents>
                                        </ext:Button>
                                        <ext:Button ID="Button1" runat="server" Text="取消">
                                            <Listeners>
                                                <Click Handler="#{moudleform}.getForm().reset();" />
                                            </Listeners>
                                        </ext:Button>
                                    </Buttons>
                                </ext:FormPanel>
                            </Items>
                        </ext:Panel>
                        <ext:GridPanel ID="GridPanel3" runat="server" Region="Center">
                            <Store>
                                <ext:Store ID="Store3" runat="server" PageSize="50" OnReadData="MyData_Refresh">
                                    <Model>
                                        <ext:Model ID="Model3" runat="server" IDProperty="lid">
                                            <Fields>
                                                <ext:ModelField Name="lid" ServerMapping="lid" />
                                                <ext:ModelField Name="lindx" ServerMapping="lindx" />
                                                <ext:ModelField Name="fieldname" ServerMapping="fieldname" />
                                                <ext:ModelField Name="fielddisplay" ServerMapping="fielddisplay" />
                                                <ext:ModelField Name="fieldwidth" ServerMapping="fieldwidth" />
                                                <ext:ModelField Name="fieldvisible" ServerMapping="fieldvisible" />
                                                <ext:ModelField Name="fieldreadonly" ServerMapping="fieldreadonly" />
                                                <ext:ModelField Name="gridfoot" ServerMapping="gridfoot" />
                                                <ext:ModelField Name="datatype" ServerMapping="datatype" />
                                                <ext:ModelField Name="showtype" ServerMapping="showtype" />
                                                <ext:ModelField Name="ctrltype" ServerMapping="ctrltype" />
                                                <ext:ModelField Name="isctrl" ServerMapping="isctrl" />
                                                <ext:ModelField Name="ctrl_x" ServerMapping="ctrl_x" />
                                                <ext:ModelField Name="ctrl_y" ServerMapping="ctrl_y" />
                                                <ext:ModelField Name="iskeyid" ServerMapping="iskeyid" />
                                                <ext:ModelField Name="ismust" ServerMapping="ismust" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <ColumnModel>
                                <Columns>
                                    <ext:Column ID="Column8" runat="server" Text="序号" DataIndex="lindx" Width="60">
                                        <Editor>
                                            <ext:TextField ID="TextField5" runat="server" />
                                        </Editor>
                                    </ext:Column>
                                    <ext:Column ID="Column9" runat="server" Text="字段" DataIndex="fieldname" Width="150">
                                        <Editor>
                                            <ext:TextField ID="TextField6" runat="server" />
                                        </Editor>
                                    </ext:Column>
                                    <ext:Column ID="Column10" runat="server" Text="名称" DataIndex="fielddisplay" Width="150">
                                        <Editor>
                                            <ext:TextField ID="TextField7" runat="server" />
                                        </Editor>
                                    </ext:Column>
                                    <ext:Column ID="Column11" runat="server" Text="宽度" DataIndex="fieldwidth" Width="100">
                                        <Editor>
                                            <ext:NumberField ID="NumberField1" runat="server" />
                                        </Editor>
                                    </ext:Column>
                                    <ext:Column ID="Column13" runat="server" Text="字段类型" DataIndex="datatype" Width="100">
                                        <Editor>
                                            <ext:ComboBox runat="server" ID="ComboBox3">
                                                <Items>
                                                    <ext:ListItem Text="字符" Value="string" />
                                                    <ext:ListItem Text="数字" Value="int" />
                                                    <ext:ListItem Text="小数" Value="float" />
                                                    <ext:ListItem Text="日期" Value="datetime" />
                                                    <ext:ListItem Text="布尔" Value="bool" />
                                                </Items>
                                            </ext:ComboBox>
                                        </Editor>
                                    </ext:Column>
                                    <ext:Column ID="Column12" runat="server" Text="网脚" DataIndex="gridfoot" Width="100">
                                        <Editor>
                                            <ext:ComboBox runat="server" ID="txtgridfoot">
                                                <Items>
                                                    <ext:ListItem Text="默认" Value="0" />
                                                    <ext:ListItem Text="汇总" Value="1" />
                                                    <ext:ListItem Text="求和" Value="2" />
                                                    <ext:ListItem Text="平均值" Value="3" />
                                                    <ext:ListItem Text="最大值" Value="4" />
                                                    <ext:ListItem Text="最小值" Value="5" />
                                                </Items>
                                            </ext:ComboBox>
                                        </Editor>
                                    </ext:Column>
                                    <ext:Column ID="Column14" runat="server" Text="显示类型" DataIndex="showtype" Width="100">
                                        <Editor>
                                            <ext:ComboBox runat="server" ID="ComboBox4">
                                                <Items>
                                                    <ext:ListItem Text="常规" Value="0" />
                                                    <ext:ListItem Text="单价" Value="1" />
                                                    <ext:ListItem Text="金额" Value="2" />
                                                    <ext:ListItem Text="数量" Value="3" />
                                                    <ext:ListItem Text="日期" Value="4" />
                                                    <ext:ListItem Text="百分比" Value="5" />
                                                </Items>
                                            </ext:ComboBox>
                                        </Editor>
                                    </ext:Column>
                                    <ext:CheckColumn ID="CheckColumn1" runat="server" Text="可视" DataIndex="fieldvisible"
                                        Width="60" Editable="true" />
                                    <ext:CheckColumn ID="CheckColumn2" runat="server" Text="只读" DataIndex="fieldreadonly"
                                        Width="60" Editable="true" />
                                    <ext:CheckColumn ID="CheckColumn4" runat="server" Text="是否唯一" DataIndex="iskeyid"
                                        Width="80" Editable="true" />
                                    <ext:CheckColumn ID="CheckColumn5" runat="server" Text="必录" DataIndex="ismust" Width="60"
                                        Editable="true" />
                                    <ext:CheckColumn ID="CheckColumn3" runat="server" Text="生成控件" DataIndex="isctrl"
                                        Width="80" Editable="true" />
                                    <ext:Column ID="Column1" runat="server" Text="控件类型" DataIndex="ctrltype" Width="100">
                                        <Editor>
                                            <ext:ComboBox runat="server" ID="ComboBox1">
                                                <Items>
                                                    <ext:ListItem Text="文本" Value="0" />
                                                    <ext:ListItem Text="日期" Value="1" />
                                                    <ext:ListItem Text="备注" Value="2" />
                                                    <ext:ListItem Text="下拉" Value="3" />
                                                    <ext:ListItem Text="选择" Value="4" />
                                                    <ext:ListItem Text="图片" Value="5" />
                                                    <ext:ListItem Text="部门" Value="6" />
                                                    <ext:ListItem Text="仓库" Value="7" />
                                                    <ext:ListItem Text="店铺" Value="8" />
                                                </Items>
                                            </ext:ComboBox>
                                        </Editor>
                                    </ext:Column>
                                    <ext:Column ID="Column2" runat="server" Text="X坐标" DataIndex="ctrl_x" Width="60">
                                        <Editor>
                                            <ext:TextField ID="TextField1" runat="server" />
                                        </Editor>
                                    </ext:Column>
                                    <ext:Column ID="Column3" runat="server" Text="Y坐标" DataIndex="ctrl_y" Width="60">
                                        <Editor>
                                            <ext:TextField ID="TextField2" runat="server" />
                                        </Editor>
                                    </ext:Column>
                                </Columns>
                            </ColumnModel>
                            <SelectionModel>
                                <ext:RowSelectionModel ID="RowSelectionModel3" runat="server" Mode="Multi" />
                            </SelectionModel>
                            <Plugins>
                                <ext:CellEditing ID="CellEditing2" runat="server" ClicksToEdit="1">
                                    <Listeners>
                                        <Edit Fn="edit2" />
                                    </Listeners>
                                </ext:CellEditing>
                            </Plugins>
                            <Buttons>
                                <ext:Button ID="Button3" runat="server" Text="删除字段" UI="Info">
                                    <DirectEvents>
                                        <Click OnEvent="BatchDel_Click" />
                                    </DirectEvents>
                                </ext:Button>
                            </Buttons>
                        </ext:GridPanel>
                    </Items>
                </ext:Panel>
                <ext:Hidden ID="hf_tree_id" runat="server" ClientIDMode="Static" />
                <ext:Hidden ID="hf_parent_id" runat="server" ClientIDMode="Static" />
                <ext:Hidden ID="hf_State" runat="server" ClientIDMode="Static" />
            </Items>
        </ext:Viewport>
    </div>
    </form>
</body>
</html>
